#ifndef _SINGLETON_H_
#define _SINGLETON_H_

template <class T> 
class singleton
{
public:
	static T* get_ptr();
	static T& get_inst();
private:
	static T* m_self;
};

template <class T> 
T* singleton<T>::m_self=0;

template <class T> 
T* singleton<T>::get_ptr()
{
	if(!m_self) 
		m_self=new T;
	return m_self;
}

template <class T> 
T& singleton<T>::get_inst()
{
	if(!m_self) 
		m_self=new T;
	return *m_self;
}

#endif